USE [NANS21V]
GO
/****** オブジェクト:  StoredProcedure [dbo].[AnyStatusKyogiflg]    スクリプト日付: 01/13/2026 17:21:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AnyStatusKyogiflg]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[AnyStatusKyogiflg]
GO

CREATE PROCEDURE [dbo].[AnyStatusKyogiflg]
	@TAIKAINO int,
	@SYUKEINO int
AS
SELECT distinct G.KYOGIFLG
FROM TBL_ANY_TIMERACE M 
 left join TBL_ANY_TIMERACE_KYOGI K 
  on M.TAIKAINO = K.TAIKAINO and M.SYUKEINO = K.SYUKEINO 
 left join TBL_KUMI G 
  on K.TAIKAINO = G.TAIKAINO and K.KYOGINO = G.KYOGINO
   and K.SUBNO = G.SUBNO and K.ROUNDNO = G.ROUNDNO
WHERE
	M.TAIKAINO = @TAIKAINO and M.SYUKEINO = @SYUKEINO